<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>车辆证书</title>
    <meta http-equiv="X-UA-Compatible" content="ie=edge,ie=11,chrome=1" />
    <link rel="stylesheet" type="text/css" href="../css/cert.css">
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/config.js"></script>
    <script type="text/javascript" src="../js/filter.js"></script>
    <script type="text/javascript" src="../js/qrcode.js"></script>
  </head>
  <body >
    <div id="appCert">
      <div class="cert-top clearfix">
        <div class="cert-logo"><img src="../images/qy-logo.png"></div>
        <div class="cert-top-text">
          <p v-if="cert.authNo">认证证书编号：<b>{{cert.authNo || '-'}}</b></p>
          <p v-if="cert.detection">车辆评估报告编号：<b>{{cert.detection.detectionNo || '-'}}</b></p>
        </div>
      </div>
      <div class="cert-title">启辕认证证书</div>
      <div class="cert-detial">
        <p>品牌型号：<b>{{res.model.modelYear+'款 '+res.brand.brandName+' '+res.series.seriesName}}</b></p>
        <p>车架号（VIN码）：<b>{{res.carVin || '暂无'}}</b></p>
        <p><span class="p-block">初登日期：<b v-if="res.carLicenceState == 1">{{res.carLicenceDate | filterDateForMonth}}</b><b v-if="res.carLicenceState == 2">未上牌</b><b v-if="res.carLicenceState == 3">新车</b></span>表显里程：<b v-if="res.carMileage">{{res.carMileage}}万公里</b><b v-else="res.carMileage">暂无</b></p>
        <p><span class="p-block">排量：<b v-if="res.carDisplacement">{{res.carDisplacement + res.carInletModel}}</b><b v-else="res.carDisplacement">暂无</b></span>变速箱：<b>{{res.carGearbox}}</b></p>
      </div>
      <div class="b-line"></div>
      <div class="cert-state">
        <p class="state-title">郑重声明</p>
        <p class="state-info">启辕汽车确认本车无重大事故损伤、无火烧、无水泡，同时启辕对本车提供1年/2万公里保修服务及30天可退服务。（购车前通过启辕二次车辆检测并激活“启辕认证”后，可享受启辕以上服务）</p>
      </div>
      <div class="cert-setting clearfix">
        <div class="cert-tel">
          <p><img src="../images/cert-www.png">网址：www.anpxd.com</p>
          <p><img src="../images/cert-tel.png">联系电话：400-150-1999</p>
          <p v-if="cert.authCreateTime"><img src="../images/cert-date.png">认证日期：{{cert.authCreateTime | filterDateForDay}}</p>
        </div>
        <div class="cert-qrcode">
          <div id="qrcode">
            <div class="qylogo">
              <img src="https://erp.anpxd.com/cars/images/logo.jpg">
            </div>
          </div>
          <p class="qrcode-text">扫一扫，看车况</p>
        </div>
      </div>
      <div class="cert-bottom clearfix">
        <p class="bottom-master">启辕汽车（盖章）</p>
        <p class="bottom-market" v-if="cert.authCompany">鉴定单位：<span class="underline">{{cert.authCompany}}</span>（盖章）</p>
      </div>
      <div class="print-btn" id="printBtn" onclick="printPriceTag()">打印证书</div>
    </div>
  </body>
  <script type="text/javascript">
    var cert = new Vue({
      el:'#appCert',
      data: {
        res:{
          model:{},
          brand:{},
          series:{},
        },
        cert:{
          detection:{}
        }
      },
    });

    $.ajax({
      type: "get",      //data 传送数据类型。post 传递
      dataType: 'json',  // 返回数据的数据类型json
      url: defaultUrl+"/controller/getPrintCarInfo",  // yii 控制器/方法
      cache: false,
      data: {'carId': carId},  //传送的数据
      error:function(){
        alert("数据传输错误");
      },success: function (data) {
        console.log(data);
        if (data.code != 1) {
          return false
        }
        cert.res = data.result.car;
        if (data.result.carAuth) {
          cert.cert = data.result.carAuth;
        }
      }
    });

    window.onload =function(){
        var qrcode = new QRCode(document.getElementById("qrcode"), {
            width : 200,//设置宽高
            height : 200
        });
        qrcode.makeCode(window.location.origin+'/wx-web/controller/wx/toWxOpenOauth2?action=carDetail&state='+carId);
    }
    function printPriceTag(){
      document.getElementById('printBtn').style.display = "none";
      window.print();
      document.getElementById('printBtn').style.display = "block";
    }


  </script>
</html>


































